package com.example.oversea_home_spring.serviceImpl;

import com.example.oversea_home_spring.bean.Order;
import com.example.oversea_home_spring.bean.Rent;
import com.example.oversea_home_spring.bean.User;
import com.example.oversea_home_spring.bean.Warehouse;
import com.example.oversea_home_spring.mapper.TraderMapper;
import com.example.oversea_home_spring.service.TraderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TraderServiceImpl implements TraderService {

    @Autowired
    TraderMapper traderMapper;

    //发布订单
    @Override
    public int addOneOrder(Order order){
        return traderMapper.addOneOrder(order);
    }


    //修改订单
    @Override
    public int updateOneOrder(Order order){
        return traderMapper.updateOneOrder(order);
    }

    //查询订单状态
    @Override
    public List<Order> selectMyOrder(String traderId){
        return traderMapper.selectMyOrder(traderId);
    }

    //查询工人：根据工人id
    @Override
    public User selectWorker(String workerId){
        return traderMapper.selectWorker(workerId);
    }


    //租用仓库
    @Override
    public int addOneWarehouse(Rent rent){
        return traderMapper.addOneWarehouse(rent);
    }

    //我的仓库
    @Override
    public List<Rent> selectMyHouse(String traderId){
        return traderMapper.selectMyHouse(traderId);
    }

    //所有仓库
    public List<Warehouse> selectAllHouse(){
        return traderMapper.selectAllHouse();
    }

}
